<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="../dist/vue.js"></script>
    <div id="app">{{fullName}}</div>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                firstname:'张',
                lastname:'三'
            },
            computed:{
                fullName(){ 
                    return this.firstname + this.lastname
                }
            },
            watch:{
                firstname(newVal,oldVal){
                    console.log(newVal)
                }
            }
        });
        setTimeout(() => {
            vm.firstname = '赵'
        }, 1000);

    </script>
</body>

</html>